
package org.upt.dcda.presentation;

import java.io.IOException;

import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.upt.dcda.UserManagerBeanRemote;
import org.upt.dcda.exceptions.BookstoreException;

/**
 * Servlet implementation class UserServlet
 */
@WebServlet("/UserServlet")
public class UserServlet extends HttpServlet
{

	@EJB
	private UserManagerBeanRemote	userManagerBean;

	/**
	 * 
	 */
	public static final long		serialVersionUID	= -647956511762003440L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public UserServlet()
	{
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
	{
		try
		{
			userManagerBean.createUser("Dragos", "Misca", "dragos.misca@gmail.com", "1234", "");
			response.getWriter().print("mere");
		}
		catch (BookstoreException be)
		{
			getServletContext().log("Caught BookstoreException: " + be, be);
		}
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,
			IOException
	{
		// TODO Auto-generated method stub
	}

}
